package com.earthea.application.task.entity;

import lombok.Getter;

import java.util.Arrays;

@Getter
public enum TaskStatus {
    INIT(0), INT_PROCESS(1), SUCCESS(2), FAIL(3),
    ;

    private final int status;

    TaskStatus(int status) {
        this.status = status;
    }

    public static TaskStatus of(int status) {
        return Arrays.stream(values()).filter(state -> state.status == status).findFirst().orElse(FAIL);
    }
}
